i have no clue on how you'd go about optimizing sum in this.